//
//  HotelStayOrderEditFooter.m
//  Traveling
//
//  Created by Northwan on 15/6/12.
//  Copyright (c) 2015年 长沙市岳麓区立早网络科技有限公司. All rights reserved.
//

#import "HotelStayOrderEditFooter.h"
#import "LoginCtrl.h"
@interface HotelStayOrderEditFooter()

@end
@implementation HotelStayOrderEditFooter

+(instancetype)initFooterView{
    return [[[NSBundle mainBundle]loadNibNamed:@"HotelStayOrderEditFooter" owner:nil options:nil]lastObject];
}

- (IBAction)tapRemove:(id)sender {
    NSInteger count =  self.countLabel.text.integerValue;
    if(count <= 1){
        count = 1;
    }else{
        count--;
    }
    [self.countLabel setText:[NSString stringWithFormat:@"%ld",count]];
}

- (IBAction)tapAdd:(id)sender {
    NSInteger count =  self.countLabel.text.integerValue;
    count++;
    [self.countLabel setText:[NSString stringWithFormat:@"%ld",count]];
}


- (IBAction)tapNext:(id)sender {
    if (ISBLANK(self.nameLabel.text)) {
        [DialogUtils showTips:@"请输入联系人姓名"];
        return;
    }
    
    if (ISBLANK(self.comeinNameLabel.text)) {
        [DialogUtils showTips:@"请输入入住人姓名"];
        return;
    }
    
    if (ISBLANK(self.phoneLabel.text) || ![self.phoneLabel.text isValidatePhone]) {
        [DialogUtils showTips:@"手机号码格式有误"];
        return;
    }
    
    if (isLogin) {
        if (self.operation) {
            self.operation();
        }
    }else{
        //跳到登录页面
        LoginCtrl *ctrl = [[LoginCtrl alloc] init];
        [self.viewController.navigationController pushViewController:ctrl animated:YES];
    }
    

}


-(void)initData:(HomeItemDetailHeaderModel *)result{
    [self.priceLabel setText:[NSString stringWithFormat:@"￥%.1f",result.currentPrice]];
}

@end
